package com.yupi.springbootinit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yupi.springbootinit.model.entity.Tourist;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface TouristMapper extends BaseMapper<Tourist> {

    @Insert("INSERT INTO tourist (tourist_name, total)  VALUES (#{touristName}, 1)  ON DUPLICATE KEY UPDATE total = total + 1")
    public Integer insertTouristTotal(@Param("touristName") String touristName);

    @Select("select total from tourist where tourist_name = #{touristName}")
    public Integer selectTouristTotal(@Param("touristName") String touristName);
}
